home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / util / sys / Mu680x0Libs.lha / Mu680x0Libs / Include / mmu / context.i < prev    next >
Encoding:
Text File  |  2001-07-27  |  9.4 KB  |  243 lines

  1.         IFND MMU_CONTEXT_I
  2. MMU_CONTEXT_I   SET     1
  3. ;*************************************************************************
  4. ;** mmu.library                                                         **
  5. ;**                                                                     **
  6. ;** a system library for arbitration and control of the MC68K MMUs      **
  7. ;**                                                                     **
  8. ;** © 1998 THOR-Software, Thomas Richter                                **
  9. ;** No commercial use, reassembly, modification without prior, written  **
  10. ;** permission of the authors.                                          **
  11. ;** Including this library in any commercial software REQUIRES a        **
  12. ;** written permission and the payment of a small fee.                  **
  13. ;**                                                                     **
  14. ;**---------------------------------------------------------------------**
  15. ;** context related definitions                                         **
  16. ;**                                     **
  17. ;** $VER: 42.2 (27.7.2001)                        **
  18. ;*************************************************************************
  19.  
  20.         IFND EXEC_TYPES_I
  21.         INCLUDE "exec/types.i"
  22.         ENDC
  23.  
  24. ;* A context keeps roughly speaking an MMU table. Lovers of unix might
  25. ;* want to use the name "process" instead, whereas an exec task or
  26. ;* a dos.library process might be called "a thread".
  27. ;* All tasks sharing one context share one logical addressing space. *
  28.  
  29. ;* The definition of the context structure: This is something you do
  30. ;* not care about. *
  31.  
  32.         STRUCTURE MMUContext,0
  33.         APTR    ctx_succ                ;struct MMUContext *
  34.         APTR    ctx_pred                ;struct MMUContext *
  35.         ;* private data here. Do not touch, modify, .... *
  36.         LABEL ctx_SIZE
  37.  
  38.  
  39. ;* A mapping node, used to define the address space. This is what you find
  40. ;* in the list arbitrated by GetMapping().
  41.  
  42. ;* This structure is stricly READ ONLY *
  43.  
  44.     STRUCTURE MappingNode,0
  45.         APTR    map_succ                ;struct MappingNode *
  46.         APTR    map_pred                ;struct MappingNode *
  47.         
  48.         ULONG   map_Lower               ;* lower address this node covers. *
  49.         ULONG   map_Higher              ;* higher address, inclusive *
  50.         ULONG   map_Flags               ;* internal use only. *
  51.         ULONG   map_Properties          ;* see below for definitions *
  52.  
  53.         ;* the next one is a big union. All entries share the same location
  54.         LABEL   map_UserData        ;* your data if this is invalid or swapped *
  55.         LABEL   map_Page        ;* destination page if bundled *
  56.         LABEL   map_Descriptor        ;* pointer to a descriptor, alternatively *
  57.         LABEL   map_Delta        ;* added to the logical address if remapped *
  58.     ULONG    map_Mask        ;* property mask for MAPP_SHARE *
  59.  
  60.         LABEL   map_SIZE
  61.  
  62.  
  63.  
  64. ;* Property types:
  65. ;* These define the "property flags" you may assign to memory with
  66. ;* SetProperties() and SetPageProperties(). *
  67.  
  68. MAPP_WRITEPROTECTED     equ     (1<<2)
  69. MAPB_WRITEPROTECTED     equ     2
  70. ;* The region is write protected and the segmentation fault exception hooks
  71. ;* will be called on a write access. *
  72.  
  73. MAPP_USED               equ     (1<<3)
  74. MAPB_USED               equ     3
  75. ;* Set by the MMU on access, querried by GetPageProperties(). *
  76.  
  77. MAPP_MODIFIED           equ     (1<<4)
  78. MAPB_MODIFIED           equ     4
  79. ;* Set by the MMU on write accesses, querried by GetPageProperties(). *
  80.  
  81. MAPP_CACHEINHIBIT       equ     (1<<6)
  82. MAPB_CACHEINHIBIT       equ     6
  83. ;* Region is cache-inhibited, by default serialized access, precise
  84. ;* exception mode *
  85.  
  86. MAPP_SUPERVISORONLY     equ     (1<<7)
  87. MAPB_SUPERVISORONLY     equ     7
  88. ;* Supervisor access only. Note that this is currently implemented by
  89. ;* marking the pages as invalid in the user MMU tables, not by setting
  90. ;* the supervisor bit. *
  91.  
  92. MAPP_USERPAGE0          equ     (1<<8)
  93. MAPB_USERPAGE0          equ     8
  94. ;* User page attribute 0, used only by 68040, 68060.
  95. ;* These bits are available at special pins of the CPU,
  96. ;* special hardware might require this. *
  97.  
  98. MAPP_USERPAGE1          equ     (1<<9)
  99. MAPB_USERPAGE1          equ     9
  100. ;* User page attribute 1 *
  101.  
  102. MAPP_GLOBAL             equ     (1<<10)
  103. MAPB_GLOBAL             equ     10
  104. ;* This memory region is global. The MMU library makes currently no
  105. ;* effective use of this flag, and it makes only a difference for the
  106. ;* 040 and 060 anyhow. *
  107.  
  108. MAPP_BLANK              equ     (1<<11)
  109. MAPB_BLANK              equ     11
  110. ;* There's no memory here. If accessed, the access is quietly tolerated,
  111. ;* even though nothing useful should be expected. This is mainly to work
  112. ;* around bad software if no enforcer is available. *
  113.  
  114. MAPP_SINGLEPAGE         equ     (1<<12)
  115. MAPB_SINGLEPAGE         equ     12
  116. ;* Give this page a private page descriptor. This flag IS A MUST
  117. ;* if you want to use GetPagePropertiesA/SetPagePropertiesA on
  118. ;* that page.  *
  119.  
  120. MAPP_COPYBACK           equ     (1<<13)
  121. MAPB_COPYBACK           equ     13
  122. ;* MC68040 or MC68060 advanced copyback mode enabled. The library sets this
  123. ;* by default for all non-chip memory. *
  124.  
  125. MAPP_INVALID            equ     (1<<14)
  126. MAPB_INVALID            equ     14
  127. ;* The page is invalid. Accessing it results in a segmentation fault, i.e.
  128. ;* the library will call the appropriate exception hooks. *
  129.  
  130. MAPP_REMAPPED           equ     (1<<15)
  131. MAPB_REMAPPED           equ     15
  132. ;* Page is redirected to a different memory region. Note that you MUST NOT
  133. ;* add this memory to the exec library free memory list because some DMA
  134. ;* devices don't support I/O from this region and the MMU library will
  135. ;* guru as soon as you try to place MMU tables in remapped memory.
  136. ;* This might change in the future. *
  137.  
  138. MAPP_SWAPPED            equ     (1<<16)
  139. MAPB_SWAPPED            equ     16
  140. ;* This page is currently swapped out. If a program accesses this, a
  141. ;* swapped-out fault is generated. UserData is available for a swapper
  142. ;* daemon, usually the memory.library. *
  143.  
  144. MAPP_ROM                equ     (1<<17)
  145. MAPB_ROM                equ     17
  146. ;* This is read-only memory, but the library tolerates write accesses
  147. ;* quietly and no hook is called on writes. Hence, this turns the memory
  148. ;* region effectively into a "ROM". *
  149.  
  150. MAPP_SHARED             equ     (1<<18)
  151. MAPB_SHARED             equ     18
  152. ;* Shares the table of the parent context. Only if this context is
  153. ;* allocated as child context of a share-able context. *
  154.  
  155. MAPP_TRANSLATED         equ     (1<<19)
  156. MAPB_TRANSLATED         equ     19
  157. ;* This memory region is - probably partially - under control of the
  158. ;* transparent translation registers and should not be touched.
  159. ;* The mmu library does not handle the transparent translation very well
  160. ;* and tries to get rid of them on startup. *
  161.  
  162. MAPP_REPAIRABLE         equ     (1<<20)
  163. MAPB_REPAIRABLE         equ     20
  164. ;* This flag allows invalid or write protected pages to get repaired on
  165. ;* a fault by software rather than by swapping in a page.
  166. ;* The mmu.library will try to make the written data available to the
  167. ;* exception hook, and will try to provide readback data for the input
  168. ;* pipeline of the CPU. Note that this is very useful for debugging tools
  169. ;* and the like, but causes quite a lot of overhead.
  170. ;* Furthermore, MAPP_REPAIRABLE pages do not get user data. *
  171.  
  172. MAPP_IMPRECISE          equ     (1<<21)
  173. MAPB_IMPRECISE          equ     21
  174. ;* If non-cacheable, allow imprecise exception mode *
  175.  
  176. MAPP_INDIRECT           equ     (1<<22)
  177. MAPB_INDIRECT           equ     22
  178. ;* Indirect table pointer to a user-provided table. Note that the mmu library
  179. ;* exception handler returns always a pointer to the descriptor pointing to
  180. ;* your descriptor, not to your descriptor directly. *
  181.  
  182. MAPP_BUNDLED            equ     (1<<23)
  183. MAPB_BUNDLED            equ     23
  184. ;* Several pages bundled to one physical page in memory, usually done to
  185. ;* map out memory. *
  186.  
  187. MAPP_USER0              equ     (1<<24)
  188. MAPB_USER0              equ     24
  189. MAPP_USER1              equ     (1<<25)
  190. MAPB_USER1              equ     25
  191. MAPP_USER2              equ     (1<<26)
  192. MAPB_USER2              equ     26
  193. MAPP_USER3              equ     (1<<27)
  194. MAPB_USER3              equ     27
  195. ;* Strictly for you. Not touched by the library. *
  196.  
  197. MAPP_NONSERIALIZED      equ     (1<<29)
  198. MAPB_NONSERIALIZED      equ     29
  199. ;* If non-cacheable, allow non-serialized access *
  200.  
  201. MAPP_IO               equ    (1<<30)
  202. MAPB_IO               equ    30
  203. ;* I/O hardware. Avoid reading/writing this if you can avoid it. *
  204.  
  205.  
  206. ;* error codes CreateMMUContext may generate: *
  207.  
  208. CCERR_TRIMMED            equ    1
  209. ;* The MMU table has been trimmed to keep care about the enlarged 
  210. ;* table size. THIS IS NOT AN ERROR. *
  211.  
  212. CCERR_UNALIGNED            equ    3    
  213. ;* The MMU library had to perform some heavy rounding, as for
  214. ;* example to MAPP_REMAPPED pages. Therefore, the mapping 
  215. ;* might be partially wrong. You possibly do not want to use
  216. ;* this setup. *
  217.  
  218. CCERR_NO_FREE_STORE        equ    103
  219. ;* Out of memory. *
  220.  
  221. CCERR_INVALID_PARAMETERS    equ    513
  222. ;* Specified parameters are invalid. *
  223.  
  224. CCERR_UNSUPPORTED        equ    514         
  225. ;* The parameters are valid, but not supported by the 
  226. ;* available hardware. *
  227.  
  228. CCERR_SHARENCOPY        equ    515             
  229. ;* tried to share and copy a context simulatenously, 
  230. ;* this cannot work. *
  231.  
  232. CCERR_NOTSHAREABLE        equ    516
  233. ;* the selected base context is not shareable. *
  234.  
  235. CCERR_SHAREOVERLEVELS        equ    517         
  236. ;* tried to make a ctx shareable that shares another context
  237. ;* already. Sharing does not allow building of trees. *
  238.  
  239. CCERR_NOPRIVSUPER        equ    518
  240. ;* sharing or shared contexts cannot have private supervisors. *
  241.  
  242.         ENDC    ;       MMU_CONTEXT_I
  243.